{include file="account/common/head"}
<style>
    .comment-list .comment {
        padding: 0 !important;
    }
    .comment-list .comment {
        padding: 5px;
    }
    .comment-list li:not(:last-child){
        border-bottom: 1px solid #eee;
    }
</style>
<script>
    document.title = "我的评论 | {:config('system.base.title')} "
</script>>
<div class="layout clearfix">
    <span class="layui-breadcrumb">
        <a href="{:url('/index/index/index')}">首页</a>
        <a><cite>我的评论</cite></a>
    </span>
    <div class="navbar">
        <div class="data layui-tab">
            <ul class="layui-tab-title">
                <li class=""><a href="{:url('/index/account/article')}">主题</a></li>
                <li class="layui-this"><a href="{:url('/index/account/comment')}">评论</a></li>
                <li class=""><a href="{:url('/index/account/collect')}">收藏</a></li>
                <li class=""><a href="{:url('/index/account/follow')}">关注</a></li>
            </ul>

            <ul class="comment-list">
                {if count($commentList.list) == 0}
                <p class="no-data">什么也没有~</p>
                {/if}
                {volist name="commentList.list" id="item" key="key"}
                <li>
                  
                    <div class="comment  {$item.type == 3 ? 'reward' : ''}">
                        {if $item.response}
                        <p class="response-comment">
                            <a href="{:url('/index/profile/index', ['uid' => $item.response_id])}" class="layui-font-blue layui-font-14">{$item.response_username}</a> ：{$item.response}
                        </p>
                        {/if}
                        {$item.comment}
                        <div>
                            <span class="layui-font-gray layui-font-12">{$item.create_time}</span>
                        </div>
                    </div>
                    <div class="action" data-id="{$item.id}">
                        <span><a class="layui-font-12 layui-font-blue"
                                href="{:url('/index/article/index' ,['art_id' => $item.article_id])}">跳转文章</a></span>
                        <span class="layui-font-12 layui-font-black"><a href="#" class="del">删除评论</a></span>
                    </div>
                </li>

                {/volist}
            </ul>
            <div class="paginate">
                {$page|raw}

            </div>

        </div>
    </div>
</div>
{include file="common/bottom"}
<script>
    layui.use(function () {
        const $ = layui.$
        $('.del').click(function () {
            let id = $($(this).parents()[1]).data('id')
            layer.confirm('确定要删除这条评论吗？', () => {
                $.get('/index/comment/del/id/' + id, (e) => {
                    if (e.code == 200) {
                        layer.msg('删除成功', { icon: 6 })
                        $($(this).parents()[2]).remove()
                    } else {
                        layer.msg('删除失败', { icon: 5 })

                    }
                })

            })
        })
    })
</script>